package ge.lowlevel.box2d;

import ge.exceptions.FunctionNonSuported;
import ge.modules.physics.PhysicsAttributes;

 
 
/**
 * 
 * @author Abel
 * That class permit a our games to be completely transparent to the physics engine layer.
 */
public abstract class FactoryBox2D
{
	private static FactoryBox2D instance = null ;
	protected static WorldGe world;
	public FactoryBox2D()
	{
	}
	
	public static void set(FactoryBox2D newinstance)
	{
		 instance = newinstance;
	}
	public static FactoryBox2D get()
	{
		return instance;
	}
	 
	public abstract BoxGe newBox(WorldGe world, PhysicsAttributes pAttr,double width, double height,double x, double y);
	/**
	 * 	Look at WorldGe documentation.
	 * 	This world creates a new world to represent the phisics, and it will clear the old world.
	 * 	If you want to use the same world in diferentes parts, you should initiate it once and then call
	 * 	to getActualWorld function form this class.
	 * @param xGravity
	 * @param yGravity
	 * @param minVertex
	 * @param maxVertex
	 * @param doSleep
	 * @param pixelPerMeter Establishes the scale of the world. By example, 30 value will mean that
	 *  	30 pixels are equal to a meter inside the world.
	 * @return
	 */
	public abstract WorldGe newWorld(double xGravity, double yGravity, double minVertex,double maxVertex,boolean doSleep,double scale);
	 
	/**
	 *  The last world created with newWolrd function
	 * @return Actual World
	 */
	public static WorldGe getActualWorld()
	{
		return world;
	}
	/**
	 * 	Makes a joint between two bodies.
	 * @param box1 World
	 * @param box2 Box (It's a box now but it will be for general bodies)
	 * @param x X joint position
	 * @param y Y joint position
	 */
	public abstract RevolutionJointGe newRevolutionJoint(BoxGe box1, BoxGe box2, double x, double y);
	/**
	 * 	Makes a joint between the world and a body.
	 * @param world World
	 * @param box Box (It's a box now but it will be for general bodies)
	 * @param x X joint position
	 * @param y Y joint position
	 */
	public abstract RevolutionJointGe newRevolutionJoint(WorldGe world, BoxGe box, double x, double y);
 	 
	 
	
}
